// pages/auth/index.js
import {request} from "../../request/index.js"
Page({
  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  },

  handletoken(e){
    const encryptedData = e.detail.encryptedData;
    const iv = e.detail.iv;
    const rawData = e.detail.rawData;
    const signature = e.detail.signature;

   wx.login({
     complete: (res) => {
       const code = res.code;  
        const loginParams = {encryptedData,iv,rawData,signature,code};
        request({url: '/users/wxlogin?data='+loginParams}).then(result=>{
          console.log(result)
        })
     }
   })

  }
})